package org.zxl.springbootdemo.mybatis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.zxl.springbootdemo.mybatis.entity.ZqhDiary;
import org.zxl.springbootdemo.mybatis.service.ZqhService;

import java.util.List;

@RestController
@RequestMapping("/mybatis")
public class ZqhController {
    @Autowired
    private ZqhService zqhService;
    @PostMapping("/insert")
    public String insert(@RequestBody ZqhDiary zqhDiary){
        zqhService.insert(zqhDiary);
        return "success";
    }

    @PostMapping("/inserts")
    public String insert(@RequestBody List<ZqhDiary> zqhDiarys){
        zqhService.insert(zqhDiarys);
        return "success";

    }

    @GetMapping("/selectAll")
    public List<ZqhDiary> selectAll(){
        return zqhService.selectAll();
    }
}
